package com.web.dao;

import com.web.VO.MyLifeVO;
import com.web.VO.MyPublishVO;
import com.web.entity.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserInstantLifeMapper {
    @Delete({
        "delete from APP_USER_INSTANT_LIFE",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into APP_USER_INSTANT_LIFE (user_id, theme, ",
        "content, videos, ",
        "photos, see_num, ",
        "share_num, create_time, ",
        "modify_time, is_review, ",
        "is_topping)",
        "values (#{userId,jdbcType=VARCHAR}, #{theme,jdbcType=VARCHAR}, ",
        "#{content,jdbcType=VARCHAR}, #{videos,jdbcType=VARCHAR}, ",
        "#{photos,jdbcType=VARCHAR}, #{seeNum,jdbcType=INTEGER}, ",
        "#{shareNum,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{modifyTime,jdbcType=TIMESTAMP}, #{isReview,jdbcType=INTEGER}, ",
        "#{isTopping,jdbcType=INTEGER})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(UserInstantLife record);

    int insertSelective(UserInstantLife record);

    @Select({
        "select",
        "id, user_id, theme, content, videos, photos, see_num, share_num, create_time, ",
        "modify_time, is_review, is_topping",
        "from APP_USER_INSTANT_LIFE",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    UserInstantLife selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(UserInstantLife record);

    @Update({
        "update APP_USER_INSTANT_LIFE",
        "set user_id = #{userId,jdbcType=VARCHAR},",
          "theme = #{theme,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=VARCHAR},",
          "videos = #{videos,jdbcType=VARCHAR},",
          "photos = #{photos,jdbcType=VARCHAR},",
          "see_num = #{seeNum,jdbcType=INTEGER},",
          "share_num = #{shareNum,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "modify_time = #{modifyTime,jdbcType=TIMESTAMP},",
          "is_review = #{isReview,jdbcType=INTEGER},",
          "is_topping = #{isTopping,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(UserInstantLife record);

    List<UserInstantLife> getInstantInfoList();

    UserInstantLife instantInfoDetails(@Param("key") String key, @Param("value") String value, @Param("userId") String userId);


    InstantInfoDemand instantInfoDemand(@Param("key") String key, @Param("value") String value, @Param("userId") String userId);

    InstantInfoRecruitment instantInfoRecruitment(@Param("key") String key, @Param("value") String value, @Param("userId") String userId);


    InstantInfotoApplyForAJob instantInfotoApplyForAJob(@Param("key") String key, @Param("value") String value, @Param("userId") String userId);

    InstantInfotoApplyForAJob instantInfoTemporaryWork(@Param("key") String key, @Param("value") String value, @Param("userId") String userId);

    InstantInfoSupply instantInfoSupply(@Param("key") String key, @Param("value") String value, @Param("userId") String userId);

    InstantInfoFourLeisureHours instantInfoFourLeisureHours(@Param("key") String key, @Param("value") String value, @Param("userId") String userId);

    InstantInfoExperts instantInfoExperts(@Param("key") String key, @Param("value") String value, @Param("userId") String userId);

    UserInstantLife findUserDynamic(@Param("typeId") Integer typeId);

    void updateCollectionNum(UserInstantLife userInstantLife);

    /**
     * 我发布的动态
     * @param userId
     * @return
     */
    List<MyPublishVO> listMyPublishLife(String userId);


}